<?php
/*
Template Name: Content-jiepai
*/
?>
<?php get_template_part( 'content', 'head' ); ?>
<?php
global $wp_query;
    //query_posts('cat=3&showposts=10&paged=&paged');
    $wp_query = new WP_Query(array('cat'=>6,'showposts'=>10,'paged'=>$paged));  //街拍容分类cat=>ID
if ( isset($_GET['order']) && ($_GET['order']=='rand') ) {
	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
	$args=array(
		'orderby' => 'rand',
		'paged' => $paged,
	);
	$arms = array_merge(
		$args,
		$wp_query->query
	);
	query_posts($arms);
}
else if ( isset($_GET['order']) && ($_GET['order']=='commented') ){
	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
	$args=array(
		'orderby' => 'comment_count',
		'order' => 'DESC',
		'paged' => $paged,
	);
    $arms = array_merge(
		$args,
		$wp_query->query
	);
    query_posts($arms);
}
else if ( isset($_GET['order']) && ($_GET['order']=='alpha') ){
	$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
	$args=array(
		'orderby' => 'title',
		'order' => 'ASC',
		'paged' => $paged,
	);
    $arms = array_merge(
		$args,
		$wp_query->query
	);
    query_posts($arms);
} if ($wp_query->have_posts()) : while ($wp_query->have_posts()) : $wp_query->the_post(); 
?>
    <div class="grid_2 bom right">
    <div class="img1"><img onload="AutoImage(170,0,this)" src="<?php echo catch_that_image() ?>"/></div>
	<div class="post">
			<!-- Post Title -->
			<h4 class="title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h4>
			<!-- Post Data -->
        <div class="sub">
          <i class="user"></i><span> <?php the_author(); ?></span>
          <i class="date"></i><span><?php the_time('Y.n.j') ?></span>
          <i class="chat"></i><span><?php comments_popup_link('0', '1', '%', '', '评论已关闭'); ?></span>
          <i class="tag"></i><span><?php the_tags((' '), '、'); ?></span>
        </div>
			<!-- Post Content -->
			<?php the_excerpt(); ?>
			<!-- Read More Button -->
	  <div class="read right"><a href="<?php the_permalink(); ?>">阅读全文</a></div>
	</div>
    </div>
		<?php endwhile; ?>	
		<?php else : ?>
		<h1 class="title"><a href="#" rel="bookmark">未找到</a></h1>
		<p>没有找到任何文章！</p>
		<?php endif;wp_reset_postdata(); ?>
		<?php get_template_part( 'content', 'foot' ); ?>